import { BasePagesResponseData, BaseResponseData } from "@renderer/interface/baseData";
import { DictTypeItem, DictsResponseData, SearchDictTypeForm } from "@renderer/interface/dicts";
import http from "@renderer/utils/request";

/**
 * 根据分类编码获取字典项
 * @param data 
 * @returns 
 */
export const getDictItemApi = (data: string[]) => http.post<DictsResponseData>('/system/dict/item/queryBatch', data)
/**
 * 获取字典类型列表
 * @param form 搜索字典类型表单
 * @returns 
 */
export const getDictTypePageApi = (form: SearchDictTypeForm) =>
	http.get<BasePagesResponseData<DictTypeItem>>('/system/dict/type/page', form)

/**
 * 新增/修改字典类型
 * @param form 字典类型项
 * @returns 
 */
export const postAOUDictTypeApi = (form: DictTypeItem) =>
	http.post<BaseResponseData<null>>(`/system/dict/type/${form.id ? 'update' : 'add'} `, form)

/**
 * 删除字典
 * @param id 字典类型id
 * @returns 
 */
export const getDictTypeDelApi = (id: string) =>
	http.get<BaseResponseData<null>>(`/system/dict/type/delete/${id}`)